<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
<style type="text/css">
	.item{
		width: 95px;
		display: inline-block;
		margin-left: 5px;
	}
</style>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
    <div id="splitter1" class="mini-splitter" vertical="true" style="width:100%;height: 70px;">
    	<div class="splitterDiv" style="border: none;">
    		<table style="width:100%;">
		        <tr>
		        	<td style="width:30%;">
		        		<span class="item">入库单编号：</span>
		                <input id="serialNum" emptyText="请输入入库单编号" class="mini-textbox" style="width:160px;" />
		        	</td>
		        	<td style="width:30%;">
		        		<span class="item">标题(模糊)：</span>
		                <input id="stitle" emptyText="请输入标题" class="mini-textbox" style="width:160px;" />
		        	</td>	   
		            <td style="width:30%;">
		            	<span class="item">仓库名称(模糊)：</span>
		                <input id="warehouseName" emptyText="请输入仓库名称" class="mini-textbox" style="width:160px;" />
		            </td>
		            <td style="display: inline-block;"><a class="mini-button" iconCls="icon-search" onclick="search()">查询</a></td>
		        </tr>
		        <tr>
		           	<td>
		                <span class="item">审核人：</span>
		                <input id="auditUser" emptyText="请输入审核人名字" class="mini-textbox" style="width:160px;" />   
		            </td>
		            <td>
		            	<span class="item">药品编号：</span>
		                <input id="medicineNo" emptyText="请输入药品编号" class="mini-textbox" style="width:160px;" />
		            </td>
		            <td>
		            	<span class="item">药品名称(模糊)：</span>
		                <input id="name" emptyText="请输入药品名称" class="mini-textbox" style="width:160px;" />
		            </td>
		            <td style="display: inline-block;"><a href="javascript:showHq();">更多</a></td>
		        </tr>
		    </table>
    	</div>
    	<div visible="false" class="splitterDiv" style="border: none;">
	    	<table style="width:100%;">
		        <tr>
		           	<td style="width:30%;">
		                <span class="item">入库时间(开始)：</span>
		                <input id="startTime" emptyText="请选择..." class="mini-datepicker" style="width: 160px" allowInput="false"/>
		            </td>
		            <td style="width:30%;">
		            	<span class="item">入库时间(结束)：</span>
		                <input id="endTime" emptyText="请选择..." class="mini-datepicker" style="width: 160px" allowInput="false"/>
		            </td>
		            <td style="width:30%;">
		            	&nbsp;
		            </td>
		            <td style="display: inline-block;"><a href="javascript:hideHq();">收起</a></td>
		        </tr>
		    </table>
		</div>
    </div>
</div>
<div class="mini-fit" >
<div id="datagrid1" class="mini-datagrid " idField="id" pageSize="20" showSummaryRow="true"
	url="statistics_storage_page.do"
	ondrawsummarycell="onDrawSummaryCell"
	style="width:100%;height:100%;">
	<div property="columns">
			<div type="indexcolumn"></div>
			<div field="sserialNum" width="100" align="center" headerAlign="center" >入库单编号</div>
			<div field="stitle" width="110" align="center"  headerAlign="center">标题</div>
			<div field="warehouseName" width="100" align="center" headerAlign="center" >仓库</div>
			<div field="storageTime" width="80" align="center" allowSort="true" headerAlign="center" >入库时间</div>
			<div field="stype" width="90" align="center" headerAlign="center" >入库类型</div>
			<div field="sauditUserName" width="60" align="center" headerAlign="center" >审核人</div>
			<div field="medicineNo" width="100" align="center" headerAlign="center" >药品编号</div>
			<div field="name" width="110" align="center" headerAlign="center" >药品名称</div>
			<div field="unit" width="50" align="center" headerAlign="center" >单位</div>
			<div field="quantity" width="100" align="center" headerAlign="center" >入库量</div>
		</div>
</div>
</div>
<script type="text/javascript">
mini.parse();

var grid = mini.get("datagrid1");
grid.load();

function search() {
    var serialNum = mini.get("serialNum").getValue();
    var title = mini.get("stitle").getValue();
    var startTime = mini.get("startTime").getFormValue();
    var endTime = mini.get("endTime").getFormValue();
    var warehouseName = mini.get("warehouseName").getValue();
    var auditUser = mini.get("auditUser").getValue();
    var medicineNo = mini.get("medicineNo").getValue();
    var name = mini.get("name").getValue();
    grid.load({serialNum: serialNum,
    	title: title,
    	startTime: startTime,
    	endTime: endTime,
    	warehouseName: warehouseName,
    	auditUser: auditUser,
    	medicineNo: medicineNo,
    	medicineName: name
    });
}

$(document).ready(function(){
	mini.parse();
	var grid = mini.get("datagrid1");
	grid.load();
});

function onDrawSummaryCell(e) {
    var rows = e.data;
    
    if (e.field == "quantity") {
        var total = 0;
        for (var i = 0 ; i < rows.length; i++) {
            var row = rows[i];
            total += row.quantity;
        }

        e.cellHtml = "总入库量: " + total;
    }
}

function showHq(){
	var splitter1 = mini.get("splitter1");
	$("#splitter1").css("height","120px");
	splitter1.showPane("2");
}

function hideHq(){
	var splitter1 = mini.get("splitter1");
	$("#splitter1").css("height","70px");
	splitter1.hidePane("2");
}
</script>
</body>
</html>